<template>
	<view>
			<u-sticky :h5-nav-height="navHeight" >
				<view class="status_bar" ></view>
				<view class="navbar">
				<view class="navbar__return" @click="goback">
					<u-icon name="arrow-left" size="40" ></u-icon>
				</view>
				<view class="navbar__search">
					<u-icon name="search" color="#000000" :size="28"></u-icon>
					<u-input placeholder="搜索园区" class="navbar__search__text"/>
				</view>
		
			<view class="navbar__submit" @click="search">搜索</view>
			</view>
		</u-sticky>
		
	<u-index-list :scrollTop="scrollTop" :index-list="indexList" >
		<view v-for="(item, index) in list" :key="index">
			<u-index-anchor :index="item.letter" />
			<view @click="changePark(item1.name)" class="list-cell u-border-bottom" v-for="(item1, index) in item.data" :key="index">
				{{item1.name}}
			</view>
		</view>
	</u-index-list>
	</view>
</template>

<script>
	import indexList from "./parkData.js";
	import store from './store.js'
	const letterArr = indexList.list.map(val => {
		return val.letter;
	})
	export default {
		data() {
			return {
				store:store,
				scrollTop: 0,
				indexList: letterArr,
				list: indexList.list,
				navHeight:0
				
			}
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		methods:{
			goback(){
				
			},
			changePark(parkName){
				this.$store.state.currentPark=parkName
				uni.navigateBack({
					delta:1,
					animationType:"pop-out",
					animationDuration:200,
					
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.navbar {
		padding: 18rpx 30rpx;
		display: flex;
		align-items: center;
		background-color: #fff;
		height: 44px;
		&__return{
			margin-right: 10px;
		}
		&__search{
			border-radius: 100rpx;
			display: flex;
			align-items: center;
			
			padding: 2rpx 30rpx;
			width: 75%;
			background-color: rgb(249, 249, 249);
			&__text{
				font-size: 26rpx;
				color:#3F536E;
				margin-left: 10rpx;
			}
		}
		&__submit{
			margin-left: 20rpx;
		}
	}
	.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #000;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}
	.list-cell:hover {
		background-color: #e5e7ea;
	}
</style>
